﻿using System;
using System.Collections.Generic;
using ggHD.Domain.Repisitories;
using LinqToDB.Mapping;

namespace ggHD.Domain.BizObj
{
    [Table(Schema = "dbo", Name = "TicketHeaders")]
    public partial class TicketHeader : IEntity<int>
    {
        [PrimaryKey, Identity]
        public long Id { get; set; } // bigint
        [Column, NotNull]
        public DateTime DateCreate { get; set; } // datetime
        [Column, NotNull]
        public string Header { get; set; } // nvarchar(512)
        [Column, Nullable]
        public int? InitiatorID { get; set; } // int
        [Column, Nullable]
        public string CustomerID { get; set; } // nvarchar(256)
        [Column, NotNull]
        public long RawMailId { get; set; } // bigint

        #region Associations

        /// <summary>
        /// FK__TicketHea__RawMa__51300E55
        /// </summary>
        [Association(ThisKey = "RawMailId", OtherKey = "Id", CanBeNull = false)]
        public RawMail TicketHeaRawMa51300E55 { get; set; }

        /// <summary>
        /// FK__TiketsOfU__Ticke__55009F39_BackReference
        /// </summary>
        [Association(ThisKey = "Id", OtherKey = "TicketId", CanBeNull = false)]
        public IEnumerable<TiketsOfUser> TiketsOfUTicke55009F39 { get; set; }

        /// <summary>
        /// FK__TicketCon__Ticke__57DD0BE4_BackReference
        /// </summary>
        [Association(ThisKey = "Id", OtherKey = "TicketHeaderId", CanBeNull = false)]
        public IEnumerable<TicketContent> TicketConTicke57DD0BE4 { get; set; }

        #endregion

        [Column("Id")]
        public int Key { get; set; }
    }
}